quit -sim
if { [string equal $tcl_platform(os) "Linux"] == 1 } {
    source "$env(HOME)/vimrc/tcl/sim.tcl"
} else {
    source "$env(HOME)/tcl/sim.tcl"
}
::Sim::map_vivado2018_03_questasim_2021_2_1_lib

set project_path /home/wj/tmp/project_1
set project_name project_1

set ip_name mac_core
set ip_files [::Sim::findIPSimFIles $project_path $project_name $ip_name]
foreach f $ip_files {
    set extension [file extension $f]
    if {[string equal $extension ".vhd"]} {
        vcom  $f
    } else {
        vlog -incr $f
    }
}

set ip_need_libs [::Sim::findIPNeedLib $project_path $project_name $ip_name]
::Sim::map_ip_lib $ip_need_libs

vlog -incr -sv ../bench/udp_tb.sv

vlog -incr      ../hdl/enthernet_top.v
vlog -incr      ../hdl/axi_udp/arp/*.v
vlog -incr      ../hdl/axi_udp/icmp/*.v
vlog -incr      ../hdl/axi_udp/*.v
vlog -incr      ../hdl/imports/*.v
vlog -incr      ../hdl/udp_user/*.v

vsim -t ps -voptargs=+acc=rn +notimingchecks \
                                    -L secureip \
                                    -L simprims_ver \
                                    -L unifast -L unifast_ver \
                                    -L unimacro -L unimacro_ver \
                                    -L unisim -L unisims_ver \
                                    -L xpm  -L xbip_utils_v3_0_9 \
                                    -L xbip_pipe_v3_0_5 -L xbip_bram18k_v3_0_5 \
                                    -L mult_gen_v12_0_14 -L axi_lite_ipif_v3_0_4 \
                                    -L tri_mode_ethernet_mac_v9_0_13 \
                                    glbl \
                                    work.enthernet_top_tb

log -r /*
radix 16

do wave.do

run 20us
